package com.cty.LinkedList;


//测试双向链表的方法
public class DoubleLinkedListDemo {
    public void Test(){
        //创建一个双向链表
        DoubleLinkedList doubleLinkedList = new DoubleLinkedList();
        heroNode2 heroNode01 = new heroNode2(1,"","");
        heroNode2 heroNode02 = new heroNode2(2,"","");
        heroNode2 heroNode03 = new heroNode2(3,"","");
        heroNode2 heroNode04 = new heroNode2(4,"","");
        //添加方法
        doubleLinkedList.add(heroNode01);
        doubleLinkedList.add(heroNode02);
        doubleLinkedList.add(heroNode03);
        //更新方法
        doubleLinkedList.update(heroNode04);
        //删除方法
        //doubleLinkedList.remove(2);
        doubleLinkedList.remove(9);
        doubleLinkedList.list();
        System.out.println("==================================");
        //测试按编号加入
        DoubleLinkedList doubleLinkedList1 = new DoubleLinkedList();
        doubleLinkedList1.addByOrder(heroNode03);
        doubleLinkedList1.addByOrder(heroNode01);
        doubleLinkedList1.addByOrder(heroNode04);
        doubleLinkedList1.addByOrder(heroNode02);
        doubleLinkedList1.list();
    }
}
